<template>
  <div>
    <home-heafer  ></home-heafer>
    <home-swiper :list="swiperList"></home-swiper>
    <home-icons :list="iconList"></home-icons>
    <home-recommend :list="recommendList"></home-recommend>
    <home-weekend :list="weekendList"></home-weekend>
  </div>
</template>

<script>
import HomeHeafer from '@/pages/home/components/Header'
import HomeSwiper from '@/pages/home/components/Swiper'
import HomeIcons from '@/pages/home/components/Icons'
import HomeRecommend from '@/pages/home/components/Recommend'
import HomeWeekend from '@/pages/home/components/Weekend'
import axios from 'axios'
export default {
  name: 'Home',
  components:{
    'home-heafer':HomeHeafer
    ,'home-swiper':HomeSwiper
    ,'home-icons':HomeIcons
    ,'home-recommend':HomeRecommend
    ,'home-weekend':HomeWeekend
  },
  data:function(){
    return{
      swiperList:[],
      iconList:[],
      recommendList:[],
      weekendList:[]
    }
  },
  methods: {
    getHomeInfo (){
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      const  data = res.data.data
        this.swiperList = data.swiperList
        this.iconList = data.iconList
        this.recommendList = data.recommendList
        this.weekendList = data.weekendList
    }
  },
  mounted:function () {
    this.getHomeInfo()
  },
}
</script>

<style scoped>
</style>
